<?xml version="1.0" encoding="UTF-8"?>


<!--
	response.inc.xsl

	Template per formattazione response
-->


<xsl:stylesheet
	version = "1.0"
	xmlns = "http://www.w3.org/1999/xhtml"
	xmlns:inc = "http://ltw0807.web.cs.unibo.it/xsl/inc"
	xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">

	<!--
		Template response
	-->
	<xsl:template match = "response">
		<xsl:element name = "div">
			<xsl:call-template name = "inc:create-output-markers"/>
				<xsl:element name = "h1">
					<xsl:text>Risultati della ricerca</xsl:text>
				</xsl:element>

				<xsl:apply-templates select = "@query"/>

				<xsl:element name = "ul">
					<xsl:apply-templates/>
				</xsl:element>
		</xsl:element>
	</xsl:template>


	<!--
		Template @query
	-->
	<xsl:template match = "response/@query[. != '']">
		<xsl:element name = "p">
			<xsl:text>secondo i parametri </xsl:text>
			<xsl:element name = "span">
				<xsl:attribute name = "class">
					<xsl:text>query-string</xsl:text>
				</xsl:attribute>
				<xsl:apply-templates/>
			</xsl:element>
		</xsl:element>
	</xsl:template>


	<!--
		Template response/metadati
	-->
	<xsl:template match="response/metadati">
		<xsl:element name = "li">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:apply-templates select="expression"/>
		</xsl:element>
	</xsl:template>


	<!--
		Template response//expression
	-->
	<xsl:template match="response//expression">
		<xsl:element name = "div">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:element name = "ul">
				<xsl:attribute name = "class">
					<xsl:text>icon-box</xsl:text>
				</xsl:attribute>
				<xsl:apply-templates select="elanguage"/>
				<xsl:apply-templates select="etype"/>
			</xsl:element>

			<xsl:apply-templates select="etitle"/>

			<xsl:element name = "ul">
				<xsl:element name = "li">
					<xsl:text>di </xsl:text>
					<xsl:apply-templates select="ecreator"/>
				</xsl:element>
				<xsl:apply-templates select="edate | ecoverage | edescription | esubject"/>
			</xsl:element>

			<xsl:apply-templates select="../work"/>
			<xsl:apply-templates select="eidentifier"/>
		</xsl:element>
	</xsl:template>


	<!--
		Template response//ecreator o response//wcreator
	-->
	<xsl:template match = "response//ecreator | response//wcreator">
		<xsl:element name = "span">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:call-template name = "inc:copy-js-attr"/>
			<xsl:apply-templates/>
		</xsl:element>
		<xsl:call-template name = "inc:create-comma-and-list"/>
	</xsl:template>


	<!--
		Template response//elanguage o response//etype
	-->
	<xsl:template match = "response//elanguage | response//etype">
		<xsl:element name = "li">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:call-template name = "inc:copy-js-attr"/>
			<xsl:element name = "img">
				<xsl:attribute name = "src">
					<xsl:text>http://ltw0807.web.cs.unibo.it/df/xhtml/img/</xsl:text>
						<xsl:value-of select = "."/>
					<xsl:text>.png</xsl:text>
				</xsl:attribute>
				<xsl:attribute name = "alt">
					<xsl:value-of select = "."/>
				</xsl:attribute>
				<xsl:attribute name = "title">
					<xsl:value-of select = "."/>
				</xsl:attribute>
			</xsl:element>
		</xsl:element>
	</xsl:template>


	<!--
		Template response//etitle
	-->
	<xsl:template match = "response//etitle">
		<xsl:element name = "h2">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:call-template name = "inc:copy-js-attr"/>
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:template>


	<!--
		Template response//edate
	-->
	<xsl:template match = "response//edate">
		<xsl:element name = "li">
			<xsl:text>Creato in data </xsl:text>
			<xsl:element name = "span">
				<xsl:call-template name = "inc:create-output-markers"/>
				<xsl:call-template name = "inc:copy-js-attr"/>
				<xsl:value-of select = "substring-after (.,'T')"/>
				<xsl:text> del </xsl:text>
				<xsl:value-of select = "substring-before (.,'T')"/>
			</xsl:element>
		</xsl:element>
	</xsl:template>



	<!--
		Template response//ecoverage
	-->
	<xsl:template match = "response//ecoverage">
		<xsl:element name = "li">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:call-template name = "inc:copy-js-attr"/>
			<xsl:text>Collocazione spazio-temporale: </xsl:text>
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:template>


	<!--
		Template response//edescription
	-->
	<xsl:template match = "response//edescription">
		<xsl:element name = "li">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:call-template name = "inc:copy-js-attr"/>
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:template>


	<!--
		Template response//esubject
	-->
	<xsl:template match = "response//esubject">
		<xsl:element name = "li">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:call-template name = "inc:copy-js-attr"/>
			<xsl:text>Argomenti: </xsl:text>
			<xsl:apply-templates select = "folksonomia"/>
		</xsl:element>
	</xsl:template>


	<!--
		Template response//folksonomia
	-->
	<xsl:template match = "response//folksonomia">
		<xsl:element name = "span">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:call-template name = "inc:copy-js-attr"/>
			<xsl:apply-templates/>
		</xsl:element>
		<xsl:call-template name = "inc:create-comma-list"/>
	</xsl:template>


	<!--
		Template response//eidentifier
	-->
	<xsl:template match = "response//eidentifier">
		<xsl:element name = "p">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:call-template name = "inc:copy-js-attr"/>
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:template>


	<!--
		Template response//work
	-->
	<xsl:template match = "response//work">
		<xsl:element name = "p">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:text>parte dell'opera </xsl:text>
			<xsl:apply-templates select="wtitle"/>
			<xsl:text> di </xsl:text>
			<xsl:apply-templates select="wcreator"/>
		</xsl:element>
	</xsl:template>


	<!--
		Template response//wtitle
	-->
	<xsl:template match = "response//wtitle">
		<xsl:element name = "span">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:call-template name = "inc:copy-js-attr"/>
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:template>

</xsl:stylesheet>
